package nl.hu.verbrandendephoenix.view;

import java.util.ArrayList;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.PasswordTextBox;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;

public class Register {

	//FieldVerifier fv = new FieldVerifier();
	private Panel pnlRegister;
	private Label lblUsername, lblPassword, lblPasswordRepeat, lblEmail;
	private TextBox txtUsername, txtEmail;
	private PasswordTextBox txtPassword, txtPasswordRepeat;
	private Button btnRegister;
	
	public Register() {
		pnlRegister = new VerticalPanel();
		pnlRegister.addStyleName("post");
	}

	public Panel constructForm() {
		Grid grdRegisterForm = new Grid(5,2);

		Label title = new Label("Registreren:");
		title.addStyleName("h1");
		pnlRegister.add(title);
		
		lblUsername = new Label("Gebruikersnaam");
		txtUsername = new TextBox();

		grdRegisterForm.setWidget(0, 0, lblUsername);
		grdRegisterForm.setWidget(0, 1, txtUsername);

		lblPassword = new Label("Wachtwoord");
		txtPassword = new PasswordTextBox();

		grdRegisterForm.setWidget(1, 0, lblPassword);
		grdRegisterForm.setWidget(1, 1, txtPassword);

		lblPasswordRepeat = new Label("Herhaal wachtwoord");
		txtPasswordRepeat = new PasswordTextBox();

		grdRegisterForm.setWidget(2, 0, lblPasswordRepeat);
		grdRegisterForm.setWidget(2, 1, txtPasswordRepeat);

		lblEmail = new Label("E-mail Adres");
		txtEmail = new TextBox();

		grdRegisterForm.setWidget(3, 0, lblEmail);
		grdRegisterForm.setWidget(3, 1, txtEmail);
		btnRegister = new Button("Registreer");
		grdRegisterForm.setWidget(4, 1, btnRegister);
		pnlRegister.add(grdRegisterForm);
	  return pnlRegister;
	}
	/**
	 * Stuurt een arraylist met textboxen terug.
	 * @return ArrayList<TextBox> Een ArrayList met alle TextBoxen uit de view Register.
	 */
	public ArrayList<TextBox> getArrTextBox() {
		ArrayList<TextBox> arrTextBox = new ArrayList<TextBox>();
		arrTextBox.add(txtUsername);
		arrTextBox.add(txtPassword);
		arrTextBox.add(txtPasswordRepeat);
		arrTextBox.add(txtEmail);
	  return arrTextBox;
	}
	/**
	 * Stuurt een register button terug
	 * @return Button de button die wordt teruggestuurd.
	 */
	public Button getBtnRegister() {
		return btnRegister;
	}
	
	public TextBox getTxtUsername() {
		return txtUsername;
	}

	public TextBox getTxtPassword() {
		return txtPassword;
	}
	
	public TextBox getTxtPasswordRepeat() {
		return txtPasswordRepeat;
	}

	public TextBox getTxtEmail() {
		return txtEmail;
	}
}
